var behaviorsbasic = require('../../behavior/basic') 
Component({
  behaviors: [behaviorsbasic],
  /**
   * 组件的属性列表
   */
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  properties: {
    objmodel: {
      type: Object,
      default: ''
    },
    
    keyval: {
      type: [ String],
      default: true
    },
    bottomnav: {
      type: Object,
      default: {}
    },
  },

  ready(){
    var nowPage = getCurrentPages();
        var acturl=""
       var  actpage =null
      if (nowPage.length) {
        actpage=nowPage[getCurrentPages().length - 1]
        acturl=   actpage.__route__;   

       
         
      }
      var  actindex=-1
      if(this.data.objmodel.css){
       var newobjmodelcss=""
       var newcss=this.data.objmodel.css.split(';')
       for(var i in newcss){
         var a=newcss[i].split(':');
         if(a[0]!='height'){
          newobjmodelcss +=newcss[i]+";"
         }else{
          newobjmodelcss +='height:calc('+ a[1] +' + env(safe-area-inset-bottom) / 2)'
         }
       }
        this.setData({
          'objmodel.css':newobjmodelcss
        })
      }
    
      if(this.data.objmodel.datalist){
        this.data.objmodel.datalist.forEach((element,idx) => {

         
          if(element.cid==1){
  
          
            if(element.url=="/"+acturl){
              actindex=idx
            }
            else if(acturl=='xc_lshop/index/index'&&element.url&&element.url.indexOf("xc_lshop/index/index")==1){
             for(var ta in actpage.options){
              if(element.url.indexOf(ta+'='+actpage.options[ta])<0){
                return
              }
             }
             actindex=idx       
            }
          } else if(element.cid==5){
            if(element.url.indexOf("syspage/h5")>-1){
              actindex=idx
            }
          }        
        });
      }
    
  
      this.setData({actindex})    

      

      
    return ;
   if(app.globalData.footnav[keyval]){
    this.setnavdata(app.globalData.footnav[keyval]);
   } 
   else
   {
    
    app.xc_sys_config.loadfootnav(keyval).then(res=>{
       if(res["status"]==1){        
        that.setnavdata(app.globalData.footnav[keyval]);
       }
      return   
 
    }) 
   }
  },
  /**
   * 组件的初始数据
   */
  data: {
    actindex:-1
  },

  /**
   * 组件的方法列表
   */
  methods: {
    loadcardlength(){
      
    }
  }
})
